package com.mf.service;

import com.mf.entity.dto.DtoIncomingDetail;

import com.mf.entity.req.ReqRelevancyById;
import com.mf.entity.req.search.SearchReqIncomingDetail;

import java.util.List;
import java.util.Map;


/**
 *
 */
public interface ServiceIncomingDetail extends BaseService<DtoIncomingDetail, SearchReqIncomingDetail> {

    /**
     * 根据来料单id查询来料单详情
     */
    List<DtoIncomingDetail> findByIncomingId(Integer incomingId);

    /**
     * 根据来料id查询来料单详情数量
     */
    Long findByIncomingIdCount(Integer incomingId);

    /**
     * 根据来料id删除来料单详情
     */
    void deleteByIncomingId(Integer incomingId);

    /**
     * 根据id,关联id，类型设置关联信息
     */
    void setRelevancy(List<ReqRelevancyById> reqRelevancyByIds, Integer incomingId, Integer relevancyType);

    /**
     * 根据 来料单id，来料明细id清除关联信息
     */
    void deleteRelevancyById(Integer incomingId, Integer id);

    /**
     * 根据关联id,类型查询 对应的关联来料单明细
     */
    List<Integer> listByRelevancyId(Integer relevancyId, Integer type);

    /**
     * 根据源id，类型查询对应map集合
     */
    Map<Integer, DtoIncomingDetail> getDtoIncomingDetailMap(Integer sourceId, Integer workSource);

    /**
     * 设置关联集合
     */
    void setRelevancyList(Integer sourceId, Integer id, Map<Integer, DtoIncomingDetail> detailMap,
                          List<ReqRelevancyById> relevancyByIds);

}

